<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<div class="header">

		<h:form id="headForm" prependId="false">
			<div class="fixfloat">
				<div id="banner">
					<h1>
						<h:link outcome="/index.xhtml" title="#{msgs.Home}">
							<h:graphicImage name="logo.gif" library="images" alt="Home" height="45px" />
						</h:link>
					</h1>
				</div>

				<div id="menu">
					<ul>
						<li><h:link outcome="/index.xhtml" value="#{msgs.Home}" /></li>
						<li><h:link outcome="/news/index.xhtml" value="#{msgs.NewsCategory}" /></li>
						<li><h:link outcome="/category/index.xhtml" value="#{msgs.Forum}" /></li>
						<li><h:link outcome="/login.xhtml" value="#{msgs.SignIn} " rendered="#{!login.userLoggedIn}"></h:link></li>

						<li><h:panelGroup rendered="#{login.userLoggedIn}">#{msgs.Hello}<h:outputLink value="/user/profilesetting/profile.xhtml"> #{login.currentUser.userId}</h:outputLink>
							</h:panelGroup></li>

						<li><p:commandLink action="#{login.logOut}" value="#{msgs.LogOut}" disabled="#{!login.userLoggedIn}" /></li>
						<li><h:link outcome="/registration/enroll.xhtml" value="#{msgs.newUser} " rendered="#{!login.userLoggedIn}"></h:link></li>
						<li><h:link id="messagesNumberx" value="#{msgs.Message} #{sessionScope.NumberOfNewMessages}" outcome="/message/messagebox.xhtml"
								disabled="#{!login.userLoggedIn}" /></li>
						<li><h:panelGroup rendered="#{login.isUserInSysadmin()}">
								<h:outputText value="#{msgs.manage}" />
								<h:link outcome="/newscategory/listcategories.xhtml?navCatId=-1" value="#{msgs.News}" /> |
								<h:link outcome="/category/listcategories.xhtml?navCatId=-1" value="#{msgs.Forum}" />
							</h:panelGroup></li>
					</ul>
				</div>


				<div id="search">
					<ui:include src="/search.xhtml"></ui:include>
				</div>
				<div id="onlineuser">
					<h:outputFormat value="#{msgs.Online_User}" rendered="#{login.userLoggedIn &amp;&amp; login.userInSysadmin}">
						<f:param value="#{onlineCounter.counter}"></f:param>
					</h:outputFormat>

				</div>

			</div>



			<ui:remove>
				<!-- show new messages in a pop up -->
				<p:dialog widgetVar="messageBoxDlg" header="Message Box" showEffect="fold" hideEffect="fold" width="200" modal="true">

					<p:dataTable id="messageList" value="#{messageBackingBean.newIncomingMessages}" var="mess">
						<p:column>
							<h:commandLink action="#{messageBackingBean.setForViewNRedirect(mess)}" value="#{mess.subject}">
							</h:commandLink>
						</p:column>
					</p:dataTable>
					<h:commandLink action="#{messageBackingBean.fetchAllInboxMessages}" value="View All Messages"></h:commandLink>
				</p:dialog>

				<!--  use it when the javascript error got fixed in primefaces3.4 -->
				<p:poll interval="60000" listener="#{messageBackingBean.fetchAllInboxMessages(constants.nameToValueMap.Message_Inbox)}" update="messagesNumberx"
					autoStart="#{login.userLoggedIn}" />
			</ui:remove>

		</h:form>

	</div>
</ui:composition>
</html>
